import { locations } from "../../../../gpu/locations";
export const StandardMaterial_def = /*wgsl*/ `
struct Material{
  opacity : f32, //0
  ao:f32, //1
  metalness: f32, //2
  roughness: f32, //3
  refraction: f32, //4
  transmission: f32, //5
  refuseLight:f32,//6
  color : vec4<f32>, //8
  emissive : vec3<f32>, // 12
  pickColor:vec3<f32> // 16
}
@group(${locations.standardMaterialProperties[0]}) @binding(${locations.standardMaterialProperties[1]}) var<uniform> baseMaterial : Material;
#if ~{def.map}
@group(${locations.map[0]}) @binding(${locations.map[1]}) var map: texture_2d<f32>;
@group(${locations.mapSampler[0]}) @binding(${locations.mapSampler[1]}) var map_sampler: sampler;
#endif
#if ~{def.mapUVTransform}
@group(${locations.mapUVTransform[0]}) @binding(${locations.mapUVTransform[1]}) var<uniform> map_uvTransform:mat4x4<f32>;
#endif
#if ~{def.emissiveMap}
@group(${locations.emissiveMap[0]}) @binding(${locations.emissiveMap[1]}) var emissiveMap: texture_2d<f32>;
@group(${locations.emissiveMapSampler[0]}) @binding(${locations.emissiveMapSampler[1]}) var emissiveMap_sampler:sampler;
#endif
#if ~{def.emissiveMapUVTransform}
@group(${locations.emissiveMapUVTransform[0]}) @binding(${locations.emissiveMapUVTransform[1]})  var<uniform> emissiveMap_uvTransform:mat4x4<f32> ;
#endif
#if ~{def.metRougMap}
@group(${locations.metRougMap[0]}) @binding(${locations.metRougMap[1]}) var metallicRoughnessMap: texture_2d<f32>;
@group(${locations.metRougMapSampler[0]}) @binding(${locations.metRougMapSampler[1]}) var metallicRoughnessMap_sampler:sampler;
#endif
#if ~{def.metRougMapUVTransform}
@group(${locations.metRougMapUVTransform[0]}) @binding(${locations.metRougMapUVTransform[1]})  var<uniform> metRougMapUVTransform:mat4x4<f32> ;
#endif
#if ~{def.normalMap}
@group(${locations.normalMap[0]}) @binding(${locations.normalMap[1]}) var normalMap: texture_2d<f32>;
@group(${locations.normalMapSampler[0]}) @binding(${locations.normalMapSampler[1]}) var normalMap_sampler:sampler;
#endif
#if ~{def.normalMapUVTransform}
@group(${locations.normalMapUVTransform[0]}) @binding(${locations.normalMapUVTransform[1]})  var<uniform> normalMap_uvTransform:mat4x4<f32> ;
#endif

#if ~{def.aoMap}
@group(${locations.aoMap[0]}) @binding(${locations.aoMap[1]}) var aoMap: texture_2d<f32>;
@group(${locations.aoMapSampler[0]}) @binding(${locations.aoMapSampler[1]}) var aoMap_sampler:sampler;
#endif
#if ~{def.aoMapUVTransform}
@group(${locations.aoMapUVTransform[0]}) @binding(${locations.aoMapUVTransform[1]})  var<uniform> aoMap_uvTransform:mat4x4<f32> ;
#endif
#if ~{def.map_uvOffset}
  @group(${locations.map_uvOffset[0]}) @binding(${locations.map_uvOffset[1]})  var<uniform> map_uvOffset:vec2<f32> ;
#endif
//精准光源的光线
#if ~{def.lightCastCount}
struct LightRay {
  color:vec3<f32>,//0
  t:f32,//type //3
  position:vec3<f32>,//4
  intensity:f32,//7
  at:vec3<f32>,//8
  range:f32,//11
  e1:f32,//12   //面光源中e1,e2对应width,height  聚光灯中对应innerCos outerCos
  e2:f32,//13
  e3:f32,//14
  e4:f32,//15
  lightViewProjMatrix:mat4x4<f32>
}
#else
struct LightRay {
  color:vec3<f32>,//0
  t:f32,//type //3
  position:vec3<f32>,//4
  intensity:f32,//7
  at:vec3<f32>,//8
  range:f32,//11
  e1:f32,//12   //面光源中e1,e2对应width,height  聚光灯中对应innerCos outerCos
  e2:f32,//13
  e3:f32,//14
  e4:f32
}
#endif
// 灯光部分
#if ~{def.punctualLight}

//精准光源
struct PunctusLight{
  lights:array<LightRay, 10>,
}
@group(${locations.punctualLight[0]}) @binding(${locations.punctualLight[1]}) var<uniform> punctusLight:PunctusLight;
@group(${locations.punctualCount[0]}) @binding(${locations.punctualCount[1]}) var<uniform> punctualCount:i32;
#endif
#if ~{def.ambientLight}
@group(${locations.ambientLight[0]}) @binding(${locations.ambientLight[1]}) var<uniform> ambientLight : AmbientLight;
struct AmbientLight {
    color:vec3<f32>,
    intensity:f32
}
#endif
#if ~{def.environmenIntensity}
@group(${locations.environmenIntensity[0]}) @binding(${locations.environmenIntensity[1]}) var<uniform> environmenIntensity: f32;
#endif 
#if ~{def.irradianceMap}
@group(${locations.irradianceMap[0]}) @binding(${locations.irradianceMap[1]}) var irradianceMap: texture_cube<f32>;
#endif
#if ~{def.prefilterMap}
@group(${locations.prefilterMap[0]}) @binding(${locations.prefilterMap[1]}) var prefilterMap: texture_cube<f32>;
#endif
#if ~{def.brdfLUT}
@group(${locations.brdfLUT[0]}) @binding(${locations.brdfLUT[1]}) var brdfLUT: texture_2d<f32>;
@group(${locations.iBLSampler[0]}) @binding(${locations.iBLSampler[1]}) var iblSampler:sampler;
#endif
#if ~{def.mapUvOffset}
@group(${locations.map_uvOffset[0]}) @binding(${locations.map_uvOffset[1]})  var<uniform> map_uvOffset:vec2<f32> ;
#endif
#if ~{def.map_uvPixel}
@group(${locations.map_uvPixel[0]}) @binding(${locations.map_uvPixel[1]})  var<uniform> map_uvPixel:f32 ;
#endif
#if ~{def.lineWidth}
@group(${locations.lineWidth[0]}) @binding(${locations.lineWidth[1]})  var<uniform> lineWidth:f32 ;
#endif
// Specular Glossiness
#if ~{def.uSG_DiffuseFactor}
@group(${locations.uSG_DiffuseFactor[0]}) @binding(${locations.uSG_DiffuseFactor[1]})  var<uniform> uSG_DiffuseFactor:vec3<f32> ;
#endif
#if ~{def.uSG_SpecularFactor}
@group(${locations.uSG_SpecularFactor[0]}) @binding(${locations.uSG_SpecularFactor[1]})  var<uniform> uSG_SpecularFactor:vec4<f32> ;
#endif
#if ~{def.uSG_GlossinessFactor}
@group(${locations.uSG_GlossinessFactor[0]}) @binding(${locations.uSG_GlossinessFactor[1]})  var<uniform> uSG_GlossinessFactor:f32 ;
#endif
#if ~{def.uSG_Diffuse}
@group(${locations.uSG_Diffuse[0]}) @binding(${locations.uSG_Diffuse[1]})  var<uniform> uSG_Diffuse:f32 ;
#endif
#if ~{def.uSG_DiffuseSampler}
@group(${locations.uSG_DiffuseSampler[0]}) @binding(${locations.uSG_DiffuseSampler[1]})  var<uniform> uSG_DiffuseSampler:f32 ;
#endif
#if ~{def.uSG_DiffuseUVTransform}
@group(${locations.uSG_DiffuseUVTransform[0]}) @binding(${locations.uSG_DiffuseUVTransform[1]})  var<uniform> uSG_DiffuseUVTransform:f32 ;
#endif
#if ~{def.uSG_SpecularGlossiness}
@group(${locations.uSG_SpecularGlossiness[0]}) @binding(${locations.uSG_SpecularGlossiness[1]})  var<uniform> uSG_SpecularGlossiness:f32 ;
#endif
#if ~{def.uSG_SpecularGlossinessSampler}
@group(${locations.uSG_SpecularGlossinessSampler[0]}) @binding(${locations.uSG_SpecularGlossinessSampler[1]})  var<uniform> uSG_SpecularGlossinessSampler:f32 ;
#endif
#if ~{def.uSG_SpecularGlossinessUVTransform}
@group(${locations.uSG_SpecularGlossinessUVTransform[0]}) @binding(${locations.uSG_SpecularGlossinessUVTransform[1]})  var<uniform> uSG_SpecularGlossinessUVTransform:f32 ;
#endif
// Sheen
#if ~{def.u_SheenColorFactor}
@group(${locations.u_SheenColorFactor[0]}) @binding(${locations.u_SheenColorFactor[1]})  var<uniform> u_SheenColorFactor:vec3<f32> ;
#endif
#if ~{def.u_SheenRoughnessFactor}
@group(${locations.u_SheenRoughnessFactor[0]}) @binding(${locations.u_SheenRoughnessFactor[1]})  var<uniform> u_SheenRoughnessFactor:f32 ;
#endif
#if ~{def.u_SheenColor}
@group(${locations.u_SheenColor[0]}) @binding(${locations.u_SheenColor[1]})  var<uniform> u_SheenColor:texture_2d<f32> ;
#endif
#if ~{def.u_SheenColorSampler}
@group(${locations.u_SheenColorSampler[0]}) @binding(${locations.u_SheenColorSampler[1]})  var<uniform> u_SheenColorSampler:sampler ;
#endif
#if ~{def.u_SheenColorUVTransform}
@group(${locations.u_SheenColorUVTransform[0]}) @binding(${locations.u_SheenColorUVTransform[1]})  var<uniform> u_SheenColorUVTransform:mat3x3 ;
#endif
#if ~{def.u_SheenRoughness}
@group(${locations.u_SheenRoughness[0]}) @binding(${locations.u_SheenRoughness[1]})  var<uniform> u_SheenRoughness:texture_2d<f32> ;
#endif
#if ~{def.u_SheenRoughnessSampler}
@group(${locations.u_SheenRoughnessSampler[0]}) @binding(${locations.u_SheenRoughnessSampler[1]})  var<uniform> u_SheenRoughnessSampler:sampler ;
#endif
#if ~{def.u_SheenRoughnessUVTransform}
@group(${locations.u_SheenRoughnessUVTransform[0]}) @binding(${locations.u_SheenRoughnessUVTransform[1]})  var<uniform> u_SheenRoughnessUVTransform:mat3x3 ;
#endif
#if ~{def.u_CharlieEnv}
@group(${locations.u_CharlieEnv[0]}) @binding(${locations.u_CharlieEnv[1]})  var<uniform> u_CharlieEnv:texture_cube<f32> ;
#endif
#if ~{def.u_CharlieEnvSampler}
@group(${locations.u_CharlieEnvSampler[0]}) @binding(${locations.u_CharlieEnvSampler[1]})  var<uniform> u_CharlieEnvSampler:sampler ;
#endif
#if ~{def.u_CharlieLUT}
@group(${locations.u_CharlieLUT[0]}) @binding(${locations.u_CharlieLUT[1]})  var<uniform> u_CharlieLUT:texture_2d<f32> ;
#endif
#if ~{def.u_CharlieLUTSampler}
@group(${locations.u_CharlieLUTSampler[0]}) @binding(${locations.u_CharlieLUTSampler[1]})  var<uniform> u_CharlieLUTSampler:sampler ;
#endif
#if ~{def.u_SheenELUT}
@group(${locations.u_SheenELUT[0]}) @binding(${locations.u_SheenELUT[1]})  var<uniform> u_SheenELUT:texture_2d<f32> ;
#endif
#if ~{def.u_SheenELUTSampler}
@group(${locations.u_SheenELUTSampler[0]}) @binding(${locations.u_SheenELUTSampler[1]})  var<uniform> u_SheenELUTSampler:sampler ;
#endif
// Clearcoat
#if ~{def.u_ClearcoatFactor}
@group(${locations.u_ClearcoatFactor[0]}) @binding(${locations.u_ClearcoatFactor[1]})  var<uniform> u_ClearcoatFactor:f32 ;
#endif
#if ~{def.u_ClearcoatRoughnessFactor}
@group(${locations.u_ClearcoatRoughnessFactor[0]}) @binding(${locations.u_ClearcoatRoughnessFactor[1]})  var<uniform> u_ClearcoatRoughnessFactor:f32 ;
#endif
#if ~{def.u_Clearcoat}
@group(${locations.u_Clearcoat[0]}) @binding(${locations.u_Clearcoat[1]})  var<uniform> u_Clearcoat:texture_2d<f32> ;
#endif
#if ~{def.u_ClearcoatSampler}
@group(${locations.u_ClearcoatSampler[0]}) @binding(${locations.u_ClearcoatSampler[1]})  var<uniform> u_ClearcoatSampler:sampler ;
#endif
#if ~{def.u_ClearcoatUVTransform}
@group(${locations.u_ClearcoatUVTransform[0]}) @binding(${locations.u_ClearcoatUVTransform[1]})  var<uniform> u_ClearcoatUVTransform:mat3x3 ;
#endif
#if ~{def.u_ClearcoatRoughness}
@group(${locations.u_ClearcoatRoughness[0]}) @binding(${locations.u_ClearcoatRoughness[1]})  var<uniform> u_ClearcoatRoughness:texture_2d<f32> ;
#endif
#if ~{def.u_ClearcoatRoughnessSampler}
@group(${locations.u_ClearcoatRoughnessSampler[0]}) @binding(${locations.u_ClearcoatRoughnessSampler[1]})  var<uniform> u_ClearcoatRoughnessSampler:sampler ;
#endif
#if ~{def.u_ClearcoatRoughnessUVTransform}
@group(${locations.u_ClearcoatRoughnessUVTransform[0]}) @binding(${locations.u_ClearcoatRoughnessUVTransform[1]})  var<uniform> u_ClearcoatRoughnessUVTransform:mat3x3 ;
#endif
#if ~{def.u_ClearcoatNormal}
@group(${locations.u_ClearcoatNormal[0]}) @binding(${locations.u_ClearcoatNormal[1]})  var<uniform> u_ClearcoatNormal:texture_2d<f32> ;
#endif
#if ~{def.u_ClearcoatNormalSampler}
@group(${locations.u_ClearcoatNormalSampler[0]}) @binding(${locations.u_ClearcoatNormalSampler[1]})  var<uniform> u_ClearcoatNormalSampler:sampler ;
#endif
#if ~{def.u_ClearcoatNormalUVTransform}
@group(${locations.u_ClearcoatNormalUVTransform[0]}) @binding(${locations.u_ClearcoatNormalUVTransform[1]})  var<uniform> u_ClearcoatNormalUVTransform:mat3x3 ;
#endif
#if ~{def.u_ClearcoatNormalScale}
@group(${locations.u_ClearcoatNormalScale[0]}) @binding(${locations.u_ClearcoatNormalScale[1]})  var<uniform> u_ClearcoatNormalScale:f32 ;
#endif
// =====
// Specular
#if ~{def.u_KHR_materials_specular_specularColorFactor}
@group(${locations.u_KHR_materials_specular_specularColorFactor[0]}) @binding(${locations.u_KHR_materials_specular_specularColorFactor[1]})  var<uniform> u_KHR_materials_specular_specularColorFactor:vec3<f32> ;
#endif
#if ~{def.u_KHR_materials_specular_specularFactor}
@group(${locations.u_KHR_materials_specular_specularFactor[0]}) @binding(${locations.u_KHR_materials_specular_specularFactor[1]})  var<uniform> u_KHR_materials_specular_specularFactor:f32 ;
#endif
#if ~{def.u_Specular}
@group(${locations.u_Specular[0]}) @binding(${locations.u_Specular[1]})  var<uniform> u_Specular:texture_2d<f32> ;
#endif
#if ~{def.u_SpecularSampler}
@group(${locations.u_SpecularSampler[0]}) @binding(${locations.u_SpecularSampler[1]})  var<uniform> u_SpecularSampler:sampler ;
#endif
#if ~{def.u_SpecularUVTransform}
@group(${locations.u_SpecularUVTransform[0]}) @binding(${locations.u_SpecularUVTransform[1]})  var<uniform> u_SpecularUVTransform:mat3x3 ;
#endif
#if ~{def.u_SpecularColor}
@group(${locations.u_SpecularColor[0]}) @binding(${locations.u_SpecularColor[1]})  var<uniform> u_SpecularColor:texture_2d<f32> ;
#endif
#if ~{def.u_SpecularColorSampler}
@group(${locations.u_SpecularColorSampler[0]}) @binding(${locations.u_SpecularColorSampler[1]})  var<uniform> u_SpecularColorSampler:sampler ;
#endif
#if ~{def.u_SpecularColorUVTransform}
@group(${locations.u_SpecularColorUVTransform[0]}) @binding(${locations.u_SpecularColorUVTransform[1]})  var<uniform> u_SpecularColorUVTransform:mat3x3 ;
#endif
// Transmission
#if ~{def.u_TransmissionFactor}
@group(${locations.u_TransmissionFactor[0]}) @binding(${locations.u_TransmissionFactor[1]})  var<uniform> u_TransmissionFactor:f32 ;
#endif
#if ~{def.u_Transmission}
@group(${locations.u_Transmission[0]}) @binding(${locations.u_Transmission[1]})  var<uniform> u_Transmission:texture_2d<f32> ;
#endif
#if ~{def.u_TransmissionSampler}
@group(${locations.u_TransmissionSampler[0]}) @binding(${locations.u_TransmissionSampler[1]})  var<uniform> u_TransmissionSampler:sampler ;
#endif
#if ~{def.u_TransmissionUVTransform}
@group(${locations.u_TransmissionUVTransform[0]}) @binding(${locations.u_TransmissionUVTransform[1]})  var<uniform> u_TransmissionUVTransform:mat3x3 ;
#endif
#if ~{def.u_TransmissionFramebuffer}
@group(${locations.u_TransmissionFramebuffer[0]}) @binding(${locations.u_TransmissionFramebuffer[1]})  var<uniform> u_TransmissionFramebuffer:texture_2d<f32> ;
#endif
#if ~{def.u_TransmissionFramebufferSampler}
@group(${locations.u_TransmissionFramebufferSampler[0]}) @binding(${locations.u_TransmissionFramebufferSampler[1]})  var<uniform> u_TransmissionFramebufferSampler:sampler ;
#endif
#if ~{def.u_TransmissionFramebufferSize}
@group(${locations.u_TransmissionFramebufferSize[0]}) @binding(${locations.u_TransmissionFramebufferSize[1]})  var<uniform> u_TransmissionFramebufferSize:vec2<i32> ;
#endif
// Volume
#if ~{def.u_ThicknessFactor}
@group(${locations.u_ThicknessFactor[0]}) @binding(${locations.u_ThicknessFactor[1]})  var<uniform> u_ThicknessFactor:f32;
#endif
#if ~{def.u_AttenuationColor}
@group(${locations.u_AttenuationColor[0]}) @binding(${locations.u_AttenuationColor[1]})  var<uniform> u_AttenuationColor:vec3<f32>;
#endif
#if ~{def.u_AttenuationDistance}
@group(${locations.u_AttenuationDistance[0]}) @binding(${locations.u_AttenuationDistance[1]})  var<uniform> u_AttenuationDistance:f32;
#endif
#if ~{def.u_Thickness}
@group(${locations.u_Thickness[0]}) @binding(${locations.u_Thickness[1]})  var<uniform> u_Thickness:texture_2d<f32> ;
#endif
#if ~{def.u_ThicknessSampler}
@group(${locations.u_ThicknessSampler[0]}) @binding(${locations.u_ThicknessSampler[1]})  var<uniform> u_ThicknessSampler:sampler ;
#endif
#if ~{def.u_ThicknessUVTransform}
@group(${locations.u_ThicknessUVTransform[0]}) @binding(${locations.u_ThicknessUVTransform[1]})  var<uniform> u_ThicknessUVTransform:mat3x3 ;
#endif
// Emissive Strength
#if ~{def.u_EmissiveStrength}
@group(${locations.u_EmissiveStrength[0]}) @binding(${locations.u_EmissiveStrength[1]})  var<uniform> u_EmissiveStrength:f32;
#endif
// IOR
#if ~{def.u_Ior}
@group(${locations.u_Ior[0]}) @binding(${locations.u_Ior[1]})  var<uniform> u_Ior:f32;
#endif
// Anisotropy
#if ~{def.u_Anisotropy}
@group(${locations.u_Anisotropy[0]}) @binding(${locations.u_Anisotropy[1]})  var<uniform> u_Anisotropy:f32;
#endif
#if ~{def.u_Anisotropy}
@group(${locations.u_Anisotropy[0]}) @binding(${locations.u_Anisotropy[1]})  var<uniform> u_Anisotropy:texture_2d<f32> ;
#endif
#if ~{def.u_AnisotropySampler}
@group(${locations.u_AnisotropySampler[0]}) @binding(${locations.u_AnisotropySampler[1]})  var<uniform> u_AnisotropySampler:sampler ;
#endif
#if ~{def.u_AnisotropyUVTransform}
@group(${locations.u_AnisotropyUVTransform[0]}) @binding(${locations.u_AnisotropyUVTransform[1]})  var<uniform> u_AnisotropyUVTransform:mat3x3 ;
#endif
// Alpha mode
#if ~{def.alphaCutoff}
@group(${locations.alphaCutoff[0]}) @binding(${locations.alphaCutoff[1]})  var<uniform> alphaCutoff:f32;
#endif
struct ColorAdjust {
  Gamm:vec3<f32>,//0
  ToneMapping:f32,//4
  ToneMappingExposure:f32, //5
  Brightness:f32,//6
  Saturation:f32,//7
  Contrast:f32,//8
};
#if ~{def.ColorAdjust}
@group(${locations.ColorAdjust[0]}) @binding(${locations.ColorAdjust[1]})  var<uniform> colorAdjust:ColorAdjust ;
#endif
#if ~{def.ShadowMap}
@group(${locations.ShadowMap[0]}) @binding(${locations.ShadowMap[1]})  var ShadowMap: texture_depth_2d_array;
@group(${locations.ShadowSampler[0]}) @binding(${locations.ShadowSampler[1]})  var ShadowSampler: sampler;
#endif
#if ~{def.pointShadow}
@group(${locations.ShadowMapPoint[0]}) @binding(${locations.ShadowMapPoint[1]})  var shadowMapPoint: texture_depth_cube_array;
@group(${locations.ShadowSamplerPoint[0]}) @binding(${locations.ShadowSamplerPoint[1]})  var shadowSamplerPoint: sampler;
#endif



// 
`
